package com.clickpaas.governmentcloud.config;

import com.bizcloud.ipaas.tb4093760b8224c4fbcff37d3fa266753.d20210207141638.codegen.*;
import com.bizcloud.ipaas.tb4093760b8224c4fbcff37d3fa266753.d20210127152100.codegen.*;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author 方延杰
 * @version 1.0
 * @since 2020/11/13 3:24 下午
 */
@Component
public class ApiInit {

    int milliseconds = 8000000;

    @Bean
    public TpolicyapplicationdemonstrationApi tpolicyapplicationdemonstrationApi() {
        TpolicyapplicationdemonstrationApi tpolicyapplicationdemonstrationApi = new TpolicyapplicationdemonstrationApi();
        tpolicyapplicationdemonstrationApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tpolicyapplicationdemonstrationApi;
    }

    @Bean
    public TlatestpolicyApi tlatestpolicyApi() {
        TlatestpolicyApi tlatestpolicyApi = new TlatestpolicyApi();
        tlatestpolicyApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tlatestpolicyApi;
    }

    @Bean
    public TindustryApi tindustryApi() {
        TindustryApi tindustryApi = new TindustryApi();
        tindustryApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tindustryApi;
    }

    @Bean
    public TsubdomainApi tsubdomainApi() {
        TsubdomainApi tsubdomainApi = new TsubdomainApi();
        tsubdomainApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tsubdomainApi;
    }

    @Bean
    public TenterprisesApi tenterprisesApi() {
        TenterprisesApi tenterprisesApi = new TenterprisesApi();
        tenterprisesApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tenterprisesApi;
    }

    @Bean
    public TpoliciesApi tpoliciesApi() {
        TpoliciesApi tpoliciesApi = new TpoliciesApi();
        tpoliciesApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tpoliciesApi;
    }

    @Bean
    public TintroductionApi tintroductionApi() {
        TintroductionApi tintroductionApi = new TintroductionApi();
        tintroductionApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tintroductionApi;
    }

    @Bean
    public TpolicydatacenterApi tpolicydatacenterApi() {
        TpolicydatacenterApi tpolicydatacenterApi = new TpolicydatacenterApi();
        tpolicydatacenterApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tpolicydatacenterApi;
    }

    @Bean
    public ThorizontalaxisApi thorizontalaxisApi(){
        ThorizontalaxisApi thorizontalaxisApi = new ThorizontalaxisApi();
        thorizontalaxisApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return thorizontalaxisApi;
    }

    @Bean
    public TmatchingresultsApi tmatchingresultsApi(){
        TmatchingresultsApi tmatchingresultsApi = new TmatchingresultsApi();
        tmatchingresultsApi.getApiClient().setConnectTimeout(milliseconds).setReadTimeout(milliseconds);
        return tmatchingresultsApi;
    }

    public static ThreadPoolExecutor threadPoolExecutor() {
        return new ThreadPoolExecutor(
                5
                , 5
                , 5L
                , TimeUnit.MINUTES
                , new LinkedBlockingQueue<>()
                , Executors.defaultThreadFactory()
                , new ThreadPoolExecutor.CallerRunsPolicy()
        );
    }


}
